#include "widget.h"
#include "ui_widget.h"
#include <QPainter>
#include <QImage>
#include <QRgb>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    QImage image(":/image.jpg");

    //修改像素点
    for(int i=100;i<=200;i++)
    {
        for(int j =100;j<=200;j++)
        {
            QRgb rgb = qRgb(0,255,0);
            image.setPixel(i,j,rgb);
        }
    }

    painter.drawImage(100,100,image);
}

